home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / scsiDiskBoot / RCS / sunSubr.s,v < prev    next >
Encoding:
Text File  |  1989-06-08  |  7.4 KB  |  346 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.3
  10. date     89.01.06.08.12.34;  author brent;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     87.05.08.17.42.23;  author brent;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     87.05.08.12.07.12;  author brent;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @Low level support
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @VM_MACH => VMMACH
  33. @
  34. text
  35. @|* sunSubr.s --
  36. |*
  37. |*     Contains misc. assembler routines for the SUN.
  38. |*
  39. |* Copyright (C) 1985 Regents of the University of California
  40. |* All rights reserved.
  41. |*
  42. |* rcs = $Header: sunSubr.s,v 1.2 87/05/08 17:42:23 brent Exp $ SPRITE (Berkeley)
  43. |*
  44.  
  45. #include "machConst.h"
  46. #include "vmSunConst.h"
  47. #include "machAsmDefs.h"
  48.  
  49. |*---------------------------------------------------------------------
  50. |*
  51. |* Sys_SetIntrLevel  --
  52. |*     
  53. |*    Enables interrupts of a certain level and above.
  54. |*    Input is a mask which specifies the interrupt level.
  55. |*
  56. |* Results:
  57. |*    The mask of the interrupt level
  58. |*
  59. |* Side effects:
  60. |*    Interrupts may be enabled or disabled.
  61. |*    Trace bit is always set to 0.
  62. |*
  63. |*---------------------------------------------------------------------
  64.  
  65.     .text
  66.     .globl    _Sys_SetIntrLevel
  67. _Sys_SetIntrLevel:
  68.     link    a6,#0
  69.     movl    a6@@(8),d1        | copy argument to d1
  70.  
  71.                         | input error check:
  72.     andw    #MACH_SR_INTMASK,d1    | make sure the arg. has just
  73.                     | the interrupt bits set.
  74.  
  75.     orw    #MACH_SR_SUPSTATE,d1    | set the supervisor state bit
  76.  
  77.     clrl    d0
  78.     movw    sr,d0            | save status register in d0
  79.     andw    #MACH_SR_INTMASK,d0    | return previous interrupt level mask
  80.  
  81.     movw    d1,sr            | put new value in status register
  82.     unlk    a6
  83.     rts
  84.  
  85. |*---------------------------------------------------------------------
  86. |*
  87. |* Sys_EnableIntr --
  88. |*     
  89. |*    Enables all classes of interrupts.
  90. |*
  91. |* Results:
  92. |*    None.
  93. |*
  94. |* Side effects:
  95. |*      Interrupts are enabled.
  96. |*    Trace bit is always set to 0
  97. |*
  98. |*---------------------------------------------------------------------
  99.  
  100.     .text
  101.     .globl    _Sys_EnableIntr
  102. _Sys_EnableIntr:
  103.     link    a6,#0
  104.     movw    #MACH_SR_LOWPRIO,sr    | enable all interrupts
  105.     unlk    a6
  106.     rts
  107.  
  108. |*---------------------------------------------------------------------
  109. |*
  110. |* Sys_DisableIntr --
  111. |*
  112. |*    Disables interrupt levels 1-6.
  113. |*
  114. |* Results:
  115. |*    None.
  116. |*
  117. |* Side effects:
  118. |*      Interrupts are disabled.
  119. |*    Trace bit is always set to 0
  120. |*
  121. |*---------------------------------------------------------------------
  122.  
  123.     .text
  124.     .globl    _Sys_DisableIntr
  125. _Sys_DisableIntr:
  126.     link    a6,#0
  127.     movw    #MACH_SR_HIGHPRIO,sr    | disable all interrupts
  128.     unlk    a6
  129.     rts
  130.  
  131. |*---------------------------------------------------------------------
  132. |*
  133. |* Sun_GetEtherAddress -
  134. |*
  135. |*    Copies the ethernet address from the id prom into the
  136. |*    argument structure.  The prom is mapped funny, so the
  137. |*    loop increments the pointer into the prom as specified in
  138. |*    the sun-2 architecture manual, section 4.8
  139. |*
  140. |*    Sun_GetEtherAddress(etherAddressPtr)
  141. |*        EtherAddress *etherAddressPtr;    destination of copy
  142. |*
  143. |* Results:
  144. |*     The argument struct has the prom's ethernet address.
  145. |*
  146. |* Side effects:
  147. |*    None.
  148. |*
  149. |*---------------------------------------------------------------------
  150. #ifdef notdef
  151.     .text
  152.     .globl    _Sun_GetEtherAddress
  153. _Sun_GetEtherAddress:
  154.     movc    sfc,d1            | Save source function code
  155.     movl    #VMMACH_MMU_SPACE,d0    | Get function code in a reg
  156.     movc    d0,sfc            | Set source function code
  157.  
  158.     movl    sp@@(4),a0        | Get pointer to target ethernet address
  159.     movl    d2,sp@@-            | save d2
  160.  
  161.     movl    #6,d0            | loop counter
  162.     movl    #VMMACH_ETHER_ADDR,a1    | The Prom address of the ethernet addr
  163. etherloop:
  164.     movsb    a1@@,d2            | Copy one byte of the ethernet address
  165.     movb    d2,a0@@            |   from prom to the target address.
  166.     addql    #1,a0            | bump target pointer
  167.     addl    #VMMACH_IDPROM_INC,a1    | bump prom address, as per sec 4.8
  168.     subl    #1,d0            | decrement loop counter
  169.     bne        etherloop        | loop 6 times
  170.  
  171.     movc    d1,sfc            | Restore source function code
  172.     movl    sp@@+,d2            | Restore d2
  173.  
  174.     rts                    | Return
  175. #endif
  176. |*---------------------------------------------------------------------
  177. |*
  178. |* Sun_TestAndSet --
  179. |*
  180. |*    int Sun_TestAndSet(intPtr)
  181. |*        int *intPtr;
  182. |*
  183. |*         Test and set an operand.
  184. |*
  185. |* Results:
  186. |*         Returns 0 if *intPtr was zero and 1 if *intPtr was non-zero.  Also
  187. |*    in all cases *intPtr is set to a non-zero value.
  188. |*
  189. |* Side effects:
  190. |*     None.
  191. |*
  192. |*---------------------------------------------------------------------
  193. #ifdef notdef
  194.     .globl _Sun_TestAndSet
  195. _Sun_TestAndSet:
  196.     clrl    d0        | Set the return register to 0.
  197.  
  198.     movl    sp@@(4), a0    | Move the address of the operand to a0.
  199.     tas        a0@@        | Test and set the operand.
  200.  
  201.     beq        1$        | If it wasn't set then just return 0.
  202.  
  203.     moveq    #1, d0        | Otherwise return 1.
  204.  
  205. 1$: rts
  206. #endif notdef
  207. |*---------------------------------------------------------------------
  208. |*
  209. |* Mach_GetMachineType -
  210. |*
  211. |*    Returns the type of machine that is stored in the id prom.
  212. |*
  213. |*    int    Sun_GetMachineType()
  214. |*
  215. |* Results:
  216. |*     The type of machine (1 or 2).
  217. |*
  218. |* Side effects:
  219. |*    None.
  220. |*
  221. |*---------------------------------------------------------------------
  222.     .text
  223.     .globl    _Mach_GetMachineType
  224. _Mach_GetMachineType:
  225.     movc    sfc,d1            | Save source function code
  226.     movl    #VMMACH_MMU_SPACE,d0    | Get function code in a reg
  227.     movc    d0,sfc            | Set source function code
  228.  
  229.     clrl    d0            | Clear the return register
  230.  
  231.     movl    #VMMACH_MACH_TYPE_ADDR, a0 | Get the address of the machine type
  232.                     |     in a register.
  233.     movsb    a0@@,d0            | Store the machine type in the return
  234.                     |     register.
  235.  
  236.     movc    d1,sfc            | Restore source function code
  237.  
  238.     rts
  239.  
  240. |*
  241. |* ----------------------------------------------------------------------
  242. |*
  243. |* Mach_MonTrap --
  244. |*
  245. |*    Trap to the monitor.  This involves dummying up a trap stack for the
  246. |*    monitor, allowing non-maskable interrupts and then jumping to the
  247. |*    monitor trap routine.  When it returns, non-maskable interrupts are
  248. |*    enabled and we return.
  249. |*
  250. |* Results:
  251. |*    None.
  252. |*
  253. |* Side effects:
  254. |*    None.
  255. |*
  256. |* ----------------------------------------------------------------------
  257. |*
  258.  
  259.     .globl    _Mach_MonTrap
  260. _Mach_MonTrap:
  261.     movl    sp@@(4), a0        | Address to trap to.
  262.     clrw    sp@@-            | Put on a dummy vector offset register.
  263.     movl    #1$, sp@@-        | Put the return address onto the stack.
  264.     movw    sr, sp@@-        | Push the current status register.
  265.     jra    a0@@            | Trap
  266. 1$:    rts
  267.  
  268. @
  269.  
  270.  
  271. 1.2
  272. log
  273. @Changed name to Mach_
  274. @
  275. text
  276. @d8 1
  277. a8 1
  278. |* rcs = $Header: sunSubr.s,v 1.1 87/05/08 12:07:12 brent Exp $ SPRITE (Berkeley)
  279. d11 1
  280. a11 1
  281. #include "sunSR.h"
  282. d13 1
  283. a13 2
  284. #include "machineConst.h"
  285. #include "asmDefs.h"
  286. d38 1
  287. a38 1
  288.     andw    #SUN_SR_INTMASK,d1    | make sure the arg. has just
  289. d41 1
  290. a41 1
  291.     orw    #SUN_SR_SUPSTATE,d1    | set the supervisor state bit
  292. d45 1
  293. a45 1
  294.     andw    #SUN_SR_INTMASK,d0    | return previous interrupt level mask
  295. d70 1
  296. a70 1
  297.     movw    #SUN_SR_LOWPRIO,sr    | enable all interrupts
  298. d93 1
  299. a93 1
  300.     movw    #SUN_SR_HIGHPRIO,sr    | disable all interrupts
  301. d121 1
  302. a121 1
  303.     movl    #VM_MMU_SPACE,d0    | Get function code in a reg
  304. d128 1
  305. a128 1
  306.     movl    #VM_ETHER_ADDR,a1    | The Prom address of the ethernet addr
  307. d133 1
  308. a133 1
  309.     addl    #VM_IDPROM_INC,a1    | bump prom address, as per sec 4.8
  310. d192 1
  311. a192 1
  312.     movl    #VM_MMU_SPACE,d0    | Get function code in a reg
  313. d197 1
  314. a197 1
  315.     movl    #VM_MACH_TYPE_ADDR, a0    | Get the address of the machine type
  316. d209 1
  317. a209 1
  318. |* Mon_Trap --
  319. d225 2
  320. a226 2
  321.     .globl    _Mon_Trap
  322. _Mon_Trap:
  323. @
  324.  
  325.  
  326. 1.1
  327. log
  328. @Initial revision
  329. @
  330. text
  331. @d8 1
  332. a8 1
  333. |* rcs = $Header: sunSubr.s,v 1.13 86/06/06 11:51:29 nelson Exp $ SPRITE (Berkeley)
  334. d176 1
  335. a176 1
  336. |* Sun_GetMachineType -
  337. a188 1
  338. #ifdef notdef
  339. d190 2
  340. a191 2
  341.     .globl    _Sun_GetMachineType
  342. _Sun_GetMachineType:
  343. a205 1
  344. #endif notdef
  345. @
  346.